import React, {Component} from 'react';
import styles from './hdb-button.module.css'
import propTypes from 'prop-types';

/*
*  type: 类型  default circ
*  clickHandler: 函数
*  style: object  行间样式
*  disabled: boolean  设置禁用
*  size: 大小  small  large  default
*  text: 按钮文字
* */

export default class HdbButton extends Component {

    static defaultProps = {
        onClick: () => {
        },
        size: 'default',
        style: {},
        disabled: false,
        type: 'default' // circ
    };

    static proptypes = {
        clickHandler: propTypes.func,
        size: propTypes.string,
        style: propTypes.object,
        disabled: propTypes.bool,
        type: propTypes.string
    };

    render() {
        let {children, style, onClick, disabled,type,size} = this.props;
        return (
            <button
                // className={`hdb-button-default hdb-button-default--large`}
                // className={`hdb-button-circ hdb-button-circ--small`}
                className={`${styles[`hdb-button-${type}`]} ${styles[`hdb-button-${type}--${size}`]}`}

                style={style}
                onClick={onClick}
                disabled={disabled}
            >
                {children ? children : '按 钮'}
            </button>
        )
    }
}